/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.matcher.builder;

import org.hamcrest.Matcher;
import ru.jSky.factory.AdapterMatcherFactory;
import ru.jSky.interfaces.support.Unmodifiable;
import ru.jSky.producer.builder.CompositeProducerBuilder;

/**
 *
 * @author Rakev
 */
public abstract class AdapterMatcherBuilder<F, C> implements Unmodifiable {

    private CompositeProducerBuilder<F, C> producerBuilder;

    public AdapterMatcherBuilder(CompositeProducerBuilder<F, C> producerBuilder) {
        this.producerBuilder = producerBuilder;
    }

    public Matcher<F> build(Matcher<C> matcher) {
        return getAdapterMatcherFactory().create(getProducerBuilder().build(), matcher);
    }

    protected CompositeProducerBuilder<F, C> getProducerBuilder() {
        return producerBuilder;
    }

    protected AdapterMatcherFactory getAdapterMatcherFactory() {
        return AdapterMatcherFactory.create();
    }
}
